import { createApp } from 'vue'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import App from './App.vue'
// 配置国际化
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import "virtual:svg-icons-register"
import allGlobalComponent from '@/components/index'
import '@/styles/index.scss'
import router from './router'
import './permission'
import pinia from './stores'
import 'element-plus/theme-chalk/dark/css-vars.css'
import { isHasbutton } from './directive/has'
const app = createApp(App)
pinia.use(piniaPluginPersistedstate)
isHasbutton(app)

pinia.use(({ store }) => {
    const initialState = JSON.parse(JSON.stringify(store.$state))
    store.$reset = () => {
      store.$state = JSON.parse(JSON.stringify(initialState))
    }
})
app.use(pinia).use(allGlobalComponent).use(ElementPlus, {
    locale: zhCn,}).use(router).mount('#app')
